// 天气图标映射
const WEATHER_ICONS = {
    'sunny': 'fa-sun',                    // 晴天
    'partly-cloudy': 'fa-cloud-sun',      // 多云
    'cloudy': 'fa-cloud',                 // 阴天
    'light-rain': 'fa-cloud-rain',        // 小雨
    'heavy-rain': 'fa-cloud-showers-heavy', // 大雨
    'thunder': 'fa-cloud-bolt',           // 雷雨
    'snow': 'fa-snowflake',              // 雪
    'wind': 'fa-wind'                    // 大风
};

// 天气预报数据
const weatherData = [
    {
        day: '今天',
        date: '02/04',
        weather: 'sunny',
        tempHigh: '8°',
        tempLow: '-2°',
        desc: '晴',
        wind: '东北风 2级'
    },
    {
        day: '明天',
        date: '02/05',
        weather: 'partly-cloudy',
        tempHigh: '10°',
        tempLow: '-1°',
        desc: '多云',
        wind: '东风 3级'
    },
    {
        day: '周三',
        date: '02/06',
        weather: 'cloudy',
        tempHigh: '7°',
        tempLow: '-3°',
        desc: '阴',
        wind: '东南风 3级'
    },
    {
        day: '周四',
        date: '02/07',
        weather: 'light-rain',
        tempHigh: '6°',
        tempLow: '-2°',
        desc: '小雨',
        wind: '南风 2级'
    },
    {
        day: '周五',
        date: '02/08',
        weather: 'thunder',
        tempHigh: '9°',
        tempLow: '1°',
        desc: '雷阵雨',
        wind: '东南风 4级'
    },
    {
        day: '周六',
        date: '02/09',
        weather: 'partly-cloudy',
        tempHigh: '11°',
        tempLow: '2°',
        desc: '晴间多云',
        wind: '东风 2级'
    },
    {
        day: '周日',
        date: '02/10',
        weather: 'sunny',
        tempHigh: '12°',
        tempLow: '3°',
        desc: '晴',
        wind: '东北风 2级'
    }
];

// 渲染天气预报
function renderWeatherForecast() {
    const forecastList = document.getElementById('forecastList');
    if (!forecastList) return;

    forecastList.innerHTML = weatherData.map(weather => `
        <div class="forecast-day">
            <div class="day">${weather.day}</div>
            <div class="date">${weather.date}</div>
            <div class="weather-icon">
                <i class="fas ${WEATHER_ICONS[weather.weather]}"></i>
            </div>
            <div class="temp">
                <span class="temp-high">${weather.tempHigh}</span>
                <span class="temp-low">${weather.tempLow}</span>
            </div>
            <div class="weather-desc">${weather.desc}</div>
            <div class="wind-info">
                <i class="fas fa-wind"></i>
                <span>${weather.wind}</span>
            </div>
        </div>
    `).join('');
}

// 导出天气模块
export { renderWeatherForecast }; 